/*
 *                  BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 * 
 * Created on Jun 22, 2007
 * 
 */

package org.biojava.services.das.dao;

public class RegistryUser {
	
	
	String openID;
	String email;
	int userID;
	Role role;
	boolean alertMe;
	
	/** a bean to store the data of a user
	 * 
	 *
	 */
	public RegistryUser(){
		role = Role.user;
		alertMe = false;
	}
	
	public boolean equals(RegistryUser user){
		if (user == null)
			return false;
		
		if ( user.getOpenID() == null)
			return false;
		
		if ( user.getOpenID().equals(this.getOpenID())){
			return true;
		}
		return false;
		
		
	}
	
	public int hashCode(){
		int h = 7;
        
        h = 31 * h + ( null == openID ? 0 : openID.hashCode());
        return h;
	}
	
	public String toString(){
		
		StringBuffer txt = new StringBuffer();
		
		txt.append("RegistryUser -");
		txt.append("openid:");
		txt.append(openID);
		
		txt.append(" email:");
		txt.append(email);
		
		txt.append(" role:");
		txt.append(role);
		
		txt.append(" user_id:");
		txt.append(userID);
		
		txt.append(" alertMe:");
		txt.append(alertMe);
		
		return txt.toString();
		
		
	}
	
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getOpenID() {
		return openID;
	}
	public void setOpenID(String openID) {
		this.openID = openID;
	}
	public int getUserID() {
		return userID;
	}
	public void setUserID(int userID) {
		this.userID = userID;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public boolean isAlertMe() {
		return alertMe;
	}

	public void setAlertMe(boolean alertMe) {
		this.alertMe = alertMe;
	}
	
	
	

}
